package com.tx.websocket.demo.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * 注册拦截器
 */
@Configuration
public class PrintWebMvcConfig implements WebMvcConfigurer {

    @Resource
    private MenuInterceptor menuInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(menuInterceptor).addPathPatterns("/**")
                .excludePathPatterns("/login", "/logout", "/error*", "/static/**", "/unauth");
    }
}
